<template>
  <el-dialog
    title="详情"
    v-model="visible"
    width="40%"
    destroy-on-close
    @closed="$emit('closed')"
  >
    <el-form
      :model="form"
      ref="dialogForm"
      :disabled="mode == 'show'"
      label-width="auto"
      label-position="right"
    >
      <el-form-item
        :label="
          form.type == 1
            ? '今日工作：'
            : form.type == 2
            ? '本周工作：'
            : '本月工作：'
        "
        style="width: 100%"
      >
        <p>{{ form.summary }}</p>
      </el-form-item>
      <el-form-item
        :label="
          form.type == 1
            ? '明日计划：'
            : form.type == 2
            ? '下周规划：'
            : '下月规划：'
        "
        style="width: 100%"
      >
        <p>{{ form.workPlan }}</p>
      </el-form-item>
      <el-form-item label="待处理问题" style="width: 100%">
        <p>{{ form.pendingIssues }}</p>
      </el-form-item>
      <el-form-item label="地址" style="width: 100%">
        <p>{{ form.address }}</p>
      </el-form-item>
      <el-form-item label="附件">
        <other-files :files="form.otherFiles"></other-files>
      </el-form-item>
      <el-form-item label="汇报给" style="width: 100%">
        <p>{{ form.userList }}</p>
      </el-form-item>
    </el-form>
  </el-dialog>
</template>

<script>
import otherFiles from '@/components/otherFiles'
export default {
  emits: ['success', 'closed'],
  data () {
    return {
      mode: "add",
      visible: false,
      //表单数据
      form: {},
      userList: ''
    }
  },
  components: {
    otherFiles
  },
  methods: {
    // 获取详情
    async getDetail (id) {
      let { data } = await this.$API.daily.getDailyById.post({ id })
      console.log(data)
      this.form = data

    },
    //显示
    open (mode = 'add') {
      this.mode = mode
      this.visible = true
      let userInfo = this.$TOOL.data.get('USER_INFO')
      this.form.createAdminId = userInfo.userId
      return this
    },
    //表单注入数据
    setData (data) {
      this.getDetail(data.id)
    },
  }
}
</script>

<style lang="scss" scoped>
:deep(.el-form-item__label) {
  color: #999;
}
</style>
